package com.infotel.test;

import java.text.DateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.Random;

//import javax.swing.JOptionPane;

public class Tableau {

    /**
     * @param args
     */
    public static void main(String[] args) {
        Date[] tab;
   
        Random rand = new Random();
        tab = new Date[Integer.parseInt(args[0])];
        for (int i = 0; i < tab.length; i++) {
            tab[i] = new Date((long) (rand.nextDouble() * Long.MAX_VALUE));
        }
        String texte = "";

        // tab2 = trierTableau(tab);
        Arrays.sort(tab);

        texte = "";
        for (int i = 0; i < tab.length; i++) {
            texte += DateFormat.getDateInstance(DateFormat.FULL).format(tab[i])
                    + " "
                    + DateFormat.getTimeInstance(DateFormat.FULL)
                            .format(tab[i]) + "\n";
            // + String.valueOf(tab2[i] + "\n");
        }
        System.out.println(texte);
        // JOptionPane.showMessageDialog(null, texte);
    }
    /*
     * public static long[] trierTableau(Date[] tab) { boolean changement =
     * true; while (changement == true) { changement = false; for (int i = 0; i
     * < tab.length - 1; i++) { if (tab[i] > tab[i + 1]) { long temp = tab[i];
     * tab[i] = tab[i + 1]; tab[i + 1] = temp; changement = true; } } } return
     * tab; }
     */

}
